home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / VU Assist Modules for MacApp / Assist Module MA 3.0 / VUAssist Source Code / UVUAssist.inc1.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  11.3 KB  |  364 lines  |  [TEXT/MPS ]

  1. (*+
  2.  *    File:        UVUAssist.inc1.p - MacApp 3.0 compatible version
  3.  *
  4.  *    Contains:    VU assistance header - MacApp 3.0 compatible version
  5.  *
  6.  *    Written by:    David Shayer
  7.  *
  8.  *    Copyright:    © 1991-92 by Apple Computer, Inc., all rights reserved.
  9.  *
  10.  *  Version: 1.0a1
  11.  *
  12.  *    Change History (most recent first):
  13.  
  14.          2/13/92    JAS        indicate 3.0 compatibility, change version
  15.          1/27/92    JAS        indicate 3.0b4 compatibility, change version
  16.          10/4/91    JAS        indicate 3.0b2 compatibility, change version
  17.          9/10/91    JAS        indicate 3.0b2PQR compatibility, change version
  18.          8/21/91    JAS        Change version
  19.          8/15/91    JAS        Remove kIncludeGridItems
  20.          8/14/91    JAS        Change CUSTOM_ITEM value to -1
  21.          8/13/91    JAS        Add CUSTOM_ITEM, kVUAssistIdleFreq, and kIncludeGridItems definitions
  22. -*)
  23.  
  24. {Historical Note:  References to the "Mole" are equivalent to references to "Agent VU".
  25. "Agent VU" was previously called the "Mole".}
  26.  
  27.  
  28. { ----------------- VUAssist proc data structures --------------------}
  29. { The following data structures and constants are not used by the mole. They're
  30. defined for the benefit of the MacApp VUAssist routine. }
  31.  
  32. TYPE
  33.  
  34. ViewItems = 
  35. (    
  36.     VINotMember,        { not a control or dialog item }
  37.     VIButton,             { TButton - this is the first control }
  38.     VIRadio,             { TRadio }
  39.     VICheckBox,         { TCheckBox }
  40.     VIScrollBar,        { TScrollBar or TSScrollBar - this is the last control }
  41.     VIPopup,             { TPopup }
  42.     VIStatText,         { TStaticText - from here on are dialog items only}
  43.     VIEditText,            { TEditText or TNumberText }
  44.     VIIcon,             { TIcon }
  45.     VIPicture,            { TPicture }
  46.     VITextEdit,            { TTEView or TDialogTEView }
  47.     VIGridItem            { cell of a TGridView }
  48. );
  49.  
  50.  
  51. CONST
  52.  
  53.     kVUAssistIdleFreq        = 1;    {This is the idle frequency of VUAssist.  By default this
  54.                                      is set to give VUAssist a very high idle frequency.  Even
  55.                                      though VUAssist does nothing with this idle time, this 
  56.                                      ensures that SystemTask will be called frequently while
  57.                                      the context of the application is the current context.  In
  58.                                      short, this enables Agent VU, which operates at SystemTask
  59.                                      while the app's context is current, to operate at maximum
  60.                                      efficiency.  This maximizes V.U. performance.  If, for some
  61.                                      reason, you would like to let the app. sleep for longer
  62.                                      periods of time, you can increase this value or, better yet,
  63.                                      call gVUAssist.SetIdleFreq with the new frequency.  Note, 
  64.                                      however, that this will cause V.U. to run more slowly against 
  65.                                      the application.}
  66.  
  67.  
  68. { ==================================================================}
  69.   
  70. { ----------------- General Mole data structures --------------------}
  71. { The following data structures are used by Agent VU (the Mole). }
  72.   
  73. TYPE  
  74.  
  75. MoleSelectors = 
  76. (
  77.     SStatus, 
  78.     GoOff, 
  79.     ComeOn, 
  80.     SBlock, 
  81.     PBlock, 
  82.     SBlkSize, 
  83.     SMouse,
  84.     PMouse,
  85.     EntKey,
  86.     SMenuInfo,            
  87.     SMenuItems,            
  88.     SetMItemKey,        
  89.     SFrontWind,            
  90.     SFindWind,            
  91.     SWindInfo,            
  92.     SFindCtl,            
  93.     SCtlInfo,            
  94.     SFindDItem,            
  95.     SDItemInfo,            
  96.     SResPeek,
  97.     SyncSBlock,
  98.     SNextEvent,
  99.     SHBlock,
  100.     PMouseString,
  101.     SIconHeight,
  102.     EmptyDeferred,
  103.     EndSelect
  104. );
  105.  
  106. MoleError = 
  107. (
  108.     mNoErr,
  109.     mUnknownSelector,
  110.     mAlreadyOnline,
  111.     mDeferredKilled,
  112.     mOtherVUHost,
  113.     mBadAddress,
  114.     mBadHandle,
  115.     mBadBlockSize,
  116.     mNoKbdDrvr,
  117.     mBigFail,
  118.     mBadTarget,
  119.     mNoCall,
  120.     mNoPendingTask,
  121.     mAppNotFound,
  122.     mNoAppInfo,
  123.     mDriverDeferred,
  124.     mBadDItemIndex,
  125.     mBadItemHdl,
  126.     mCursBusy,
  127.     mBadMenuRank,
  128.     mBadMenuID,
  129.     mBadMenuItemIndex,
  130.     mBadLastMenuItemIndex,
  131.     mHandleTooBig,
  132.     mEndErr
  133. );
  134.  
  135.  
  136. { ----------------- Window related data structures --------------------}
  137.  
  138. CONST
  139.     { used in the valid flags field }
  140.     { The valid flags field reflects which of the traits ( fields ) the Mole was able
  141.     to fill in accurately. }
  142.     VKIND            = 0;
  143.     VWRECT            = 1;        
  144.     VRANK            = 2;
  145.     VFLAGS            = 3;
  146.     VVARIANT        = 4;
  147.     VCTLCOUNT        = 5;
  148.     VTITLE            = 6;
  149.     VALERTP            = 7;
  150.     VITEMCNT        = 8;
  151.     VITEMLIST        = 9;
  152.     VPART            = 10;
  153.     VKIND_MASK        = $0001;
  154.     VRECT_MASK        = $0002;
  155.     VRANK_MASK        = $0004;
  156.     VFLAGS_MASK        = $0008;
  157.     VVARIANT_MASK    = $0010;
  158.     VCTLCNT_MASK    = $0020;
  159.     VTITLE_MASK        = $0040;
  160.     VITEMCNT_MASK    = $0080;
  161.     VPART_MASK        = $0100;
  162.     VALL_W_MASK        = $007F;
  163.     VALL_D_MASK        = $00FF;
  164.  
  165.     MWD_TITLE_LEN    = 64;
  166.  
  167.     UNSPECIFIED_RANK = -1;
  168.  
  169. TYPE
  170.     SendFindWindowParam = Point;    { point to test, in global coords }
  171.     SendFindWindowParamPtr = ^SendFindWindowParam;
  172.  
  173.     DWindReqPtr = ^integer;            { this isn't a real mole type, I made it up. }
  174.  
  175.     { This is the format of the Output buffer for SWindInfo calls. }
  176.     MoleWindowDescriptor = RECORD
  177.         validFlags:        integer;    { which of the following have valid data }
  178.         windowKind:        integer;    { as in window record - standard, dialog,
  179.                                        system, alert }
  180.         portRect:        Rect;        { as in window's grafport }
  181.         structRect:        Rect;        { boundary rect of struct rgn - global coords }
  182.         contentRect:    Rect;        { boundary rect of content region - global coords }
  183.         windowPart:        integer;    { returned by some calls }
  184.         windowRank:        integer;    { rank in window list, 1->N }
  185.         windowFlags:    integer;    { visible, hilited, go-Away, spare }
  186.         windowVariant:    integer;    { variation code extracted from high byte of
  187.                                        window defproc handle }
  188.         controlCount:    integer;    { how many controls in the control list }
  189.         numItems:    integer;        { number of items in item list }
  190.         {  The title field either has a pointer to the window title as a pascal string,
  191.            or the text of the window title extending off into the buffer }
  192.         CASE integer OF    
  193.             1: (text_ptr: ^SignedByte);
  194.             2: (text: SignedByte);
  195.             3: (text_name: Str255);    { this type is not defined by the mole, 
  196.                                     its here for the convenience of Pascal programmers,
  197.                                     who can't cast anything into anything. }
  198.     END;
  199.     MoleWDescPtr = ^MoleWindowDescriptor;
  200.     
  201.  
  202. { ----------------- Control related data structures --------------------}
  203.  
  204. CONST
  205.     
  206.     VCWINDOW            = 0;
  207.     VCRECT                = 1;
  208.     VCVALUE                = 2;
  209.     VCMIN                = 3;
  210.     VCMAX                = 4;
  211.     VCHILITE            = 5;
  212.     VCPART                = 6;
  213.     VCRANK                = 7;
  214.     VCTITLE                = 8;
  215.     VCWINDOWRANK_MASK    = $0001;
  216.     VCRECT_MASK            = $0002;
  217.     VCVALUE_MASK        = $0004;
  218.     VCMIN_MASK            = $0008;
  219.     VCMAX_MASK            = $0010;
  220.     VCHILITE_MASK        = $0020;
  221.     VCPART_MASK            = $0040;
  222.     VCRANK_MASK            = $0080;
  223.     VCVARIANT_MASK        = $0100;
  224.     VCTITLE_MASK        = $0200;
  225.     VALL_C_MASK            = $03FF;
  226.  
  227.     { standard CDEF IDs }
  228.     POPUP_CDEF            = 63;
  229.  
  230. TYPE
  231.     SendFindControlParam = Point;    { point to test, in global coords }
  232.     SendFindControlParamPtr = ^SendFindControlParam;
  233.  
  234.     { This is the format of the Input buffer for SCtlInfo calls. }
  235.     SendControlInfoParams = RECORD 
  236.         control_rank        :integer;        { rank in control list }
  237.         window_rank            :integer;        { rank of owning window amongst visible windows }
  238.     END;
  239.     SendCtlInfoParamsPtr = ^SendControlInfoParams;
  240.  
  241.     { This is the format of the Output buffer for SCtlInfo calls. }
  242.     MoleControlDescriptor = RECORD            { mole control descriptor }
  243.         validFlags            :integer;        { which of the following have valid data }
  244.         owner_rank            :integer;        { rank of owning window amongst visible windows }
  245.         ctlRect                :Rect;            { The ctl fileds are copied from the }
  246.         ctlValue            :integer;        {  control record }
  247.         ctlMin                :integer;
  248.         ctlMax                :integer;
  249.         ctlHilite            :integer;
  250.         part                :integer;        { filled in on some calls }
  251.         ctlRank                :integer;        { rank in owning window's control List }
  252.         ctlDefID            :integer;        { variation code from def proc handle }
  253.         popupMenuID            :integer;        { resource ID of popup menu }
  254.         { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
  255.            the title field either has a pointer to the control title as a pascal string,
  256.            or the text of the control title extending off into the buffer }
  257.         CASE integer OF 
  258.             1: (text_ptr: ^SignedByte);
  259.             2: (text_buf: SignedByte);
  260.             3: (text_name: Str255);    { this type is not defined by the mole, 
  261.                                     its here for the convenience of Pascal programmers. }
  262.     END;
  263.     MoleCDescPtr = ^MoleControlDescriptor;
  264.  
  265.  
  266. { ----------------- Dialog related data structures --------------------}
  267.  
  268. CONST
  269.     btnCtrlItem    = 4;
  270.     chkCtrlItem    = 5;
  271.     radCtrlItem    = 6;
  272.     resCtrlItem    = 7;
  273.  
  274.     RANK_OF_THE_INVISIBLE = -2;
  275.     CUSTOM_ITEM              = -1;        {special constant for items which do no fit into any
  276.                                      of the other content item categories}
  277.  
  278.  
  279. TYPE
  280.     SendDItemInfoParams = RECORD 
  281.         item_num            :integer;        { index in dialogs item list }
  282.         window_rank            :integer;        { rank of owning window amongst visible windows }
  283.     END;
  284.     SendDItemInfoPtr = ^SendDItemInfoParams;
  285.     
  286.     MoleDItemInfo = RECORD                  { mole dialog item info }
  287.         box                    :Rect;            { item bounding box }
  288.         ctlRank                :longint;         { if a control - then the control's rank in the control list }
  289.         itemType            :SignedByte;    { item type }
  290.         item_enabled        :Boolean;
  291.         has_text            :Boolean;
  292.         owner_rank            :integer;
  293.         item_num            :integer;
  294.         { Referring to the Note on Descriptor and Info Records above ( see Marks menu ),
  295.            the itemData field either has a pointer to the control title as a pascal string,
  296.            or the text of the control itemData extending off into the buffer, OR the
  297.            short integer which is the resource ID of the icon or picture assocaited with
  298.            the item. }
  299.         CASE integer OF 
  300.             1: (text_buf        :SignedByte);    { static, edit, or control title text }
  301.             2: (item_text_ptr    :^SignedByte);
  302.             3: (itemResID        :integer);
  303.             4: (text_name: Str255);    { this type is not defined by the mole, 
  304.                                     its here for the convenience of Pascal programmers. }
  305.     END; 
  306.     MoleDItemInfoPtr = ^MoleDItemInfo;
  307.  
  308.  
  309. { ----------------- Menu related data structures --------------------}
  310.  
  311. TYPE
  312.     SendMenuInfoParams = RECORD
  313.         menu_rank            :integer;        { left-to-right rank in menu bar }
  314.         menu_ID                :integer;        { ID of menu, if known }
  315.     END;
  316.     SendMenuInfoParamsPtr = ^SendMenuInfoParams;
  317.  
  318.     MoleMenuInfo = RECORD
  319.         num_items            :longint;        { number of items in the menu }
  320.         rank                :longint;        { in menu bar, left to right }
  321.         left_edge            :longint;        { as extracted from the menu list field }
  322.         menuID                :integer;        { menu ID as known to the menu manager }
  323.         menuWidth            :integer;        { assuming a rectangular menu, the width in pixels
  324.                                                    NOT the position on the screen! }
  325.         menuHeight            :integer;        { assuming a rectangular menu, the height in pixels
  326.                                                    NOT the position on the screen! }
  327.         enableFlags            :longint;        { Least significant bit is one if the menu iteself is 
  328.                                                    enabled.  Other bits describe the enabled state of 
  329.                                                 the first 31 items }
  330.          { the menu field either has a pointer to the menu title as a pascal string,
  331.            or the text of the menu title extending off into the buffer }
  332.         CASE integer OF 
  333.             1: (Data            :^SignedByte);
  334.             2: (title_text        :SignedByte);    
  335.             3: (text_name: Str255);    { this type is not defined by the mole, 
  336.                                     its here for the convenience of Pascal programmers. }
  337.     END; 
  338.     MoleMenuInfoPtr = ^MoleMenuInfo;
  339.         
  340.     SendMenuItemsParams = RECORD
  341.         menu_rank            :integer;        { left-to-right rank in menu bar }
  342.         menu_ID                :integer;        { ID of menu, if known }
  343.         start_item            :integer;        { rank of item in menu to start the block with }
  344.         stop_item            :integer;        { rank of last item in the menu we are interested in }
  345.     END;
  346.     SendMenuItemsParamsPtr = ^SendMenuItemsParams;
  347.  
  348.  
  349.  
  350. { ----------------- Mole data block structures --------------------}
  351.  
  352. CONST
  353.     MOLE_DATA_BLOCKSIZE = 512;                { a nice, arbitrary, round number }
  354.     ADDITIONAL_MENU_ITEM_DATA = 5;            { bytes in a menu item subrec in addition to 
  355.                                               the text of the menu item (don't ask, its ugly) }
  356. TYPE
  357.     MoleDataBlock = RECORD
  358.         blockLength            :integer;        { blockLength }
  359.         dataBlock            :PACKED ARRAY [0..MOLE_DATA_BLOCKSIZE-1] OF char;    
  360.         { the returned packet will only be a long as needed to send the requested data }
  361.     END;
  362.     MoleDataBlockPtr = ^MoleDataBlock;
  363.  
  364.